package com.ffapp.demo.bean;

import android.text.TextUtils;

import com.alibaba.fastjson.annotation.JSONField;

import java.util.List;

public class UserInfoBean extends BasisBean {

    /**
     *
     */
    private static final long serialVersionUID = 1L;


    /**
     * 隐藏职位，0：普通职员，1：驾驶员，2：审核员，（勤务站） 3：处长，4：分管领导，5：支队主官，6:副大队长 7大队主官
     */
//    public static final int HIDE_POST_NORMAL = 0, HIDE_POST_DRIVER = 1, HIDE_POST_CHECKER = 2
////			,HIDE_POST_LEADER_CHU = 3
//            , HIDE_POST_LEADER_FEN = 4, HIDE_POST_LEADER_ZHI = 5, HIDE_POST_DD_DEPUTY_CAPTAIN = 6, HIDE_POST_DD_LEADER = 7;

    /*** 队伍管理角色ID */
    public static final String FLOW_TEAM_MANAGE_ROLE_ID = "1ca6345807808f1aa7917c7193ec9165";
    /*** 支队主管，审批支队级、大队级出辖区的公务用车 */
    public static final String FLOW_ZD_OFFICER_ROLE_ID = "c73304963b8d96a96c8b18529d92aaff";
    /*** 分管领导，审批支队级出辖区、8h以外辖区内的公务用车————修改为办公室领导了*/
    public static final String FLOW_ZD_LEADER_ROLE_ID = "196b852dea7a84f901e948f35e611954";
    /*** 大队主官，审批大队级公务用车 */
    public static final String FLOW_DD_OFFICER_ROLE_ID = "27b9dd4fb15ea0ab0f1e7ffefb6927c4";
    /*** 副大队长，审批大队级公务用车、指派车辆及驾驶员、更改车辆指派 */
    public static final String FLOW_DD_LEADER_ROLE_ID = "8c7114c5b56b33a71ab7dc0333256bbe";
    /*** 勤务站审批员，审批支队级公务用车、指派车辆及驾驶员、更改车辆指派 */
    public static final String FLOW_CHECKER_ROLE_ID = "fee1bb92505f9b13401e74cbf1be2d8a";
    /*** 驾驶员，驾驶员，接收驾驶任务 */
    public static final String FLOW_DRIVER_ROLE_ID = "59d3a7bb70674a620224c388cb632656";
    /*** 隐患管理员，负责指派隐患至各大队管理员，也可直接处理隐患 */
    public static final String FLOW_TROUBLE_MANAGE_ROLE_ID = "14169d4fdc26a71d3850b953e247bded";
    /*** 大队管理员，负责指派隐患至具体处理人执行 */
    public static final String FLOW_TROUBLE_DD_MANAGE_ROLE_ID = "fedf26b4b0110559d46224537b4e605d";
    /*** 中队干部审批消防站消防员的请假申请 */
    public static final String FLOW_MID_MEMBER_ROLE_ID = "90c13efe00dbb0b0ae8d9dbe440856ed";
    /*** 大队干部，审批大队、消防站消防员的请假申请 */
    public static final String FLOW_DD_MEMBER_ROLE_ID = "7df5147108ae87600605fa196f17f2ac";
    /*** 处室负责人 */
    public static final String FLOW_ROLE_ID_CS_FZR = "a467be1072f948459942cca4e01ad8e9";
    /*** 分管领导 审批支队异常考勤报备申请 */
    public static final String FLOW_ROLE_ID_FEN_MANAGER = "16758446563";

    public static final String FLOW_ADMIN = "1ca6345807808f1aa7917c7193ec9165";

    /*** 队务人员---用于判断模块  个人信息档案 APP_MEMBER_MANAGEMENT*/
    public static final String FLOW_DYRY_ROLE_ID  = "206F1A1E8A54D08AF6CFB50B93FDE16A";

    public static final String FLOW_KEY_MANAGER_ALL = "smart_key_01";
    public static final String FLOW_KEY_MANAGER_CAR = "smart_key_02";
    public static final String FLOW_KEY_MANAGER_XINGTONG = "smart_key_03";
    public static final String FLOW_KEY_MANAGER_MEDICAL = "smart_key_04";


    /**
     * 用户组别，0：系统用户，1：内部用户，2：微消站用户
     */
    public static final int GROUP_USER_SYSTERM = 0, GROUP_USER_INNER = 1, GROUP_USER_FIRSTATION = 2;


    /**
     * manageType : 2
     * roles : {}
     * name : admin
     * id : a6c5260fcc71d2a18ec7f5d52f1b96e5
     * modules : ["F_ALARM_ACCEPTED_HIDDEN_DANGER_EXPORT","F_LOG_LOGIN_LOG_SEARCH","F_LOG_LOGIN_LOG_EXPORT","F_LOG_ALARM_GEO_LOG","F_LOG_ALARM_GEO_LOG_SEARCH","F_LOG_ALARM_GEO_LOG_EXPORT","F_LOG_HIDDEN_DANGER_GEO_LOG","F_LOG_HIDDEN_DANGER_GEO_LOG_SEARCH","F_LOG_HIDDEN_DANGER_GEO_LOG_EXPORT","F_LOG_HIDDEN_DANGER_PROCESSING_LOG","F_LOG_HIDDEN_DANGER_PROCESSING_LOG_SEARCH","F_LOG_HIDDEN_DANGER_MESSAGE_LOG","F_LOG_HIDDEN_DANGER_MESSAGE_LOG_SEARCH","F_ALARM_CLOSED_HIDDEN_DANGER","M_HISTORY_CASE_LIST","F_HISTORY_CASE_LIST_SEARCH","F_HISTORY_CASE_LIST_EXPORT","F_HISTORY_CASE_LIST_CLASSIFY","F_HISTORY_CASE_CLASSIFICATION_SEARCH","F_HISTORY_CASE_CLASSIFICATION_ADD","F_HISTORY_CASE_CLASSIFICATION_EDIT","F_HISTORY_CASE_CLASSIFICATION_DELETE","M_MESSAGE","F_MESSAGE_SEARCH","F_MESSAGE_PASS","F_MESSAGE_REJECT","F_MESSAGE_DELETE","M_TRAIN","F_TRAIN_SEARCH","F_ALARM_CLOSED_HIDDEN_DANGER_SEARCH","F_ALARM_CLOSED_HIDDEN_DANGER_EXPORT","M_REAL_NAME","F_REAL_NAME_REAL_NAME","F_REAL_NAME_REAL_NAME_SEARCH","F_REAL_NAME_REAL_NAME_ADD_BLACKLIST","F_REAL_NAME_BLACKLIST","F_REAL_NAME_BLACKLIST_RELEASE","F_REAL_NAME_BLACKLIST_PERMANENTLY_CLOSE","M_SYSTEM_SETTINGS","M_SYSTEM_SETTINGS_ALERT_SETTINGS","F_SYSTEM_SETTINGS_ALERT_SETTINGS_LOAD","F_SYSTEM_SETTINGS_ALERT_SETTINGS_UPDATE","F_TRAIN_EXPORT","M_VERSION","F_VERSION_EDIT","F_VERSION_DELETE","F_REAL_NAME_REAL_NAME_EXPORT","F_REAL_NAME_BLACKLIST_EXPORT","M_LARGE_SCREEN","F_LARGE_SCREEN","F_ALARM_NEW_ALERT","F_ALARM_NEW_ALERT_SEARCH","F_ALARM_NEW_ALERT_EXPORT","F_ALARM_ADJUDICATED","F_ALARM_ADJUDICATED_SEARCH","F_ALARM_ADJUDICATED_EXPORT","F_ALARM_NEW_HIDDEN_DANGER","F_ALARM_NEW_HIDDEN_DANGER_SEARCH","F_ALARM_NEW_HIDDEN_DANGER_EXPORT","F_ALARM_ACCEPTED_HIDDEN_DANGER","F_ALARM_ACCEPTED_HIDDEN_DANGER_SEARCH","M_SYSTEM_SETTINGS_AUTHORITY_MANAGEMENT","F_SYSTEM_SETTINGS_AUTHORITY_MANAGEMENT_ROLE","F_LOG_HIDDEN_DANGER_PROCESSING_LOG_EXPORT","M_HISTORY_CASE_CLASSIFICATION","F_SYSTEM_SETTINGS_AUTHORITY_MANAGEMENT_ROLE_SEARCH","F_SYSTEM_SETTINGS_AUTHORITY_MANAGEMENT_ROLE_ADD","F_SYSTEM_SETTINGS_AUTHORITY_MANAGEMENT_ROLE_EDIT","F_SYSTEM_SETTINGS_AUTHORITY_MANAGEMENT_ROLE_DELETE","F_SYSTEM_SETTINGS_AUTHORITY_MANAGEMENT_SEARCH","F_SYSTEM_SETTINGS_AUTHORITY_MANAGEMENT_UPDATE","M_LOG","F_LOG_LOGIN_LOG","F_LOG_HIDDEN_DANGER_MESSAGE_LOG_EXPORT","M_HISTORY","F_REAL_NAME_BLACKLIST_SEARCH","M_SYSTEM_SETTINGS_PEOPLE_MANAGEMENT","M_ALARM"]
     */

    private String manageType;
    private String roles;
    private String name;
    private String id;
    private String alias;
    private String deptId;
    private String deptName;
    private int userGroup = GROUP_USER_FIRSTATION;
    private List<String> modules;
    //	private int hidePost;
    private List<String> flowRoleIds;
    //84坐标系
    private double longitude;
    private double latitude;
    private String information;
    private String avatar;
    private String post;
    private boolean isRedUser;


    public String getManageType() {
        return manageType;
    }

    public void setManageType(String manageType) {
        this.manageType = manageType;
    }

    public String getRoles() {
        return roles;
    }

    public void setRoles(String roles) {
        this.roles = roles;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public List<String> getModules() {
        return modules;
    }

    public void setModules(List<String> modules) {
        this.modules = modules;
    }

    public String getAlias() {
        return alias;
    }

    public void setAlias(String alias) {
        this.alias = alias;
    }

//    public int getHidePost() {
//        return hidePost;
//    }

//    public String getHidePost_NAME() {
//        switch (hidePost) {
//            case HIDE_POST_NORMAL:
//                return "普通职员";
//            case HIDE_POST_DRIVER:
//                return "驾驶员";
//            case HIDE_POST_CHECKER:
//                return "审核员";
////			case HIDE_POST_LEADER_CHU:
////				return "处室负责人";
//            case HIDE_POST_LEADER_FEN:
//                return "分管领导";
//            case HIDE_POST_LEADER_ZHI:
//                return "支队主官";
//            case HIDE_POST_DD_DEPUTY_CAPTAIN:
//                return "副大队长";
//            case HIDE_POST_DD_LEADER:
//                return "大队主官";
//
//        }
//        return "普通职员";
//    }

//	public void setHidePost(int hidePost) {
//		this.hidePost = hidePost;
//	}

    public String getDeptId() {
        return deptId;
    }

    public void setDeptId(String deptId) {
        this.deptId = deptId;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    @JSONField(serialize = false)
    public boolean isPublishRight() {
        if (modules == null || modules.size() == 0) return false;
        for (String item : modules) {
            if (item.equals("APP_TZGG_EDIT")) {
                return true;
            }
        }
        return false;
    }

    @JSONField(serialize = false)
    public boolean isDutyRight() {
        if (modules == null || modules.size() == 0) return false;
        for (String item : modules) {
            if (item.equals("APP_DUTY")) {
                return true;
            }
        }
        return false;
    }

    @JSONField(serialize = false)
    public boolean isCanApplyVacation() {
        if(flowRoleIds == null || flowRoleIds.size() == 0)return true;
        for(String id:flowRoleIds){
            if(id.equals(FLOW_TEAM_MANAGE_ROLE_ID))return false;
            if(id.equals(FLOW_MID_MEMBER_ROLE_ID))return false;
            if(id.equals(FLOW_DD_MEMBER_ROLE_ID))return false;
            if(id.equals(FLOW_ROLE_ID_CS_FZR))return false;
        }
        return true;
    }


    @JSONField(serialize = false)
    public boolean isCanConfirmReturnVacation() {
        if(flowRoleIds == null || flowRoleIds.size() == 0)return false;
        for(String id:flowRoleIds){
            if(id.equals(FLOW_MID_MEMBER_ROLE_ID))return true;
            if(id.equals(FLOW_DD_MEMBER_ROLE_ID))return true;
            if(id.equals(FLOW_ROLE_ID_CS_FZR))return true;
        }
        return false;
    }

    public int getUserGroup() {
        return userGroup;
    }

    public void setUserGroup(int userGroup) {
        this.userGroup = userGroup;
    }

    public boolean isUserInner() {
        return userGroup == GROUP_USER_INNER;
    }

    public boolean isUserCompany() {
        return userGroup == GROUP_USER_FIRSTATION;
    }

    public double getLongitude() {
        return longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public double getLatitude() {
        return latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public String getInformation() {
        return information;
    }

    public void setInformation(String information) {
        this.information = information;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getPost() {
        if(TextUtils.isEmpty(post))return "";
        return post;
    }

    public void setPost(String post) {
        this.post = post;
    }

    public List<String> getFlowRoleIds() {
        return flowRoleIds;
    }

    public void setFlowRoleIds(List<String> flowRoleIds) {
        this.flowRoleIds = flowRoleIds;
    }

    @JSONField(serialize = false)
    public boolean isRoleContans(String roesId){
    	if(flowRoleIds == null || flowRoleIds.size() == 0)return false;
    	for(String id:flowRoleIds){
    		if(id.equals(roesId))return true;
		}
    	return false;
	}

	@JSONField(serialize = false)
    public boolean isAdmin(){
        return isRoleContans(FLOW_ADMIN);
    }

    public boolean isRedUser() {
        return isRedUser;
    }

    public void setRedUser(boolean redUser) {
        isRedUser = redUser;
    }

    @JSONField(serialize = false)
    public boolean isKeyManager() {
        if(flowRoleIds == null || flowRoleIds.size() == 0)return false;
        for(String id:flowRoleIds){
            if(id.equals(FLOW_KEY_MANAGER_ALL))return true;
            if(id.equals(FLOW_KEY_MANAGER_CAR))return true;
            if(id.equals(FLOW_KEY_MANAGER_MEDICAL))return true;
            if(id.equals(FLOW_KEY_MANAGER_XINGTONG))return true;
        }
        return false;
    }

    @JSONField(serialize = false)
    public boolean isKeyManagerOf(String keyType) {
        if(flowRoleIds == null || flowRoleIds.size() == 0)return false;
        if(TextUtils.isEmpty(keyType))return true;
        for(String id:flowRoleIds){
            if(id.equals(FLOW_KEY_MANAGER_ALL))return true;
//            if(id.equals(FLOW_KEY_MANAGER_CAR))return true;
//            if(id.equals(FLOW_KEY_MANAGER_XINGTONG))return true;
//            if(id.equals(FLOW_KEY_MANAGER_MEDICAL))return true;
            if(id.equals(FLOW_KEY_MANAGER_CAR) && keyType.equals("1"))return true;
            if(id.equals(FLOW_KEY_MANAGER_CAR) && keyType.equals("公务车"))return true;
            if(id.equals(FLOW_KEY_MANAGER_XINGTONG)&& keyType.equals("2"))return true;
            if(id.equals(FLOW_KEY_MANAGER_XINGTONG)&& keyType.equals("通信车"))return true;
            if(id.equals(FLOW_KEY_MANAGER_MEDICAL) && keyType.equals("3"))return true;
            if(id.equals(FLOW_KEY_MANAGER_MEDICAL) && keyType.equals("医疗车"))return true;
        }
        return false;
    }

    @JSONField(serialize = false)
    public boolean isLocsignManager() {
        if(flowRoleIds == null || flowRoleIds.size() == 0)return false;
        for(String id:flowRoleIds){
            if(id.equals(FLOW_ROLE_ID_FEN_MANAGER))return true;
            if(id.equals(FLOW_ZD_OFFICER_ROLE_ID))return true;
            if(id.equals(FLOW_ROLE_ID_CS_FZR))return true;
            if(id.equals(FLOW_DD_OFFICER_ROLE_ID))return true;
            if(id.equals(FLOW_DD_LEADER_ROLE_ID))return true;
            if(id.equals(FLOW_MID_MEMBER_ROLE_ID))return true;
        }
        return false;
    }
}
